﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using System;
using XKPlatform.Common.Const;

namespace XKPlatform
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args)
        {

            var config = new ConfigurationBuilder()
                       .Build();
            GlobleConst.TokenEndpoint = config["IdentityService:TokenEndpoint"];

            return WebHost.CreateDefaultBuilder(args)
                    .UseConfiguration(config)
                    .UseStartup<Startup>()
                    .UseKestrel(options =>
                    {
                        options.Limits.MaxRequestBodySize = long.MaxValue;
                        options.Limits.MaxRequestBufferSize = long.MaxValue;
                        options.Limits.MaxRequestLineSize = int.MaxValue;
                    });
        }
        //发布后配置 webconfig
        //        <?xml version = "1.0" encoding="utf-8"?>
        //<configuration>
        // <location path = "." inheritInChildApplications="false">
        //  <system.webServer>
        //   <handlers>
        //    <add name = "aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
        //   </handlers>
        //   <aspNetCore processPath = "dotnet" arguments=".\WebCoreTest.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout">
        //    <environmentVariables>
        //     <environmentVariable name = "ASPNETCORE_ENVIRONMENT" value="Development" />
        //    </environmentVariables>
        //   </aspNetCore>
        //  </system.webServer>
        // </location>
        //</configuration>
    }
}
